home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / utility / vserial.zip / VSERIAL.TXT
Text File  |  1992-09-19  |  4KB  |  90 lines

  1. From time to time I have seen messages on various bulletin boards complaining
  2. about and questioning the volume serial numbers used in DOS for versions 4 and
  3. 5.  Here's the full scoop on diskette serial numbers:
  4.  
  5. The volume serial number was introduced with DOS 4.0 as part of an extended
  6. boot record and is created through either FORMAT or DISKCOPY.  The serial
  7. number is a function of the time/date of formatting.
  8.  
  9. The first part of the serial number is equal to the sum of the time (seconds
  10. and hundredths of a second) and the date (month and day);   The second part of
  11. the serial number is equal to the sum of the time (hours and minutes) and date
  12. (year), where all numbers are in hex.  For example, a diskette formatted at
  13. 8:32:43.65 on 7/21/1991, will contain a serial number of 3256:0FE7, derived as
  14. follows:
  15.  
  16. the first part of the serial number will be
  17.   Time    43.65    2B41  (43 decimal = 2B hex; 65 decimal = 41 hex)
  18. + Date     7/21    0715  ( 7 decimal = 07 hex; 21 decimal = 15 hex)
  19.                    3256
  20.  
  21. the second part of the serial number will be
  22.   Time     8:32    0820  ( 8 decimal = 08 hex; 32 decimal = 20 hex)
  23. + Date     1991    07C7  ( 1991 decimal = 07C7 hex)
  24.                    0FE7
  25.  
  26. There is nothing unique about the serial number.  It is possible to have
  27. different diskettes, which were formatted at wildly different times contain
  28. the same serial number.  However the probability of such an occurrence is very
  29. small.
  30.  
  31. The following DOS INT 21h functions may be used to set or determine the serial
  32. number (taken from Ralf Brown's INTERRUPT listing):
  33.  
  34. INT 21 - DOS 3.2+ - IOCTL - GENERIC BLOCK DEVICE REQUEST
  35.         AX = 440Dh
  36.         BL = drive number (00h=default,01h=A:,etc)
  37.         CX = 0846h      - set volume serial number
  38.         CX = 0866h      - get volume serial number
  39.  
  40. DS:DX
  41. Offset  Size    Description
  42.  00h    WORD    info level (00h)
  43.  02h    DWORD   disk serial number (binary)
  44.  06h 11 BYTEs   volume label or "NO NAME    "
  45.  11h  8 BYTEs   file system type "FAT12   " or "FAT16   " (CL=66h only)
  46.  
  47. Return: CF set on error            AX = error code
  48.         CF clear if successful
  49.  
  50. -------------------------------------------------------------------------
  51. INT 21 - DOS 4.0 internal - GET/SET DISK SERIAL NUMBER
  52.         AX = 6900h      - get serial number
  53.         AX = 6901h      - set serial number
  54.         BL = drive (0=default, 1=A, 2=B, etc)
  55.  
  56. DS:DX
  57. Offset  Size    Description
  58.  00h    WORD    info level (zero)
  59.  02h    DWORD   disk serial number (binary)
  60.  06h 11 BYTEs   volume label or "NO NAME    " if none present
  61.  11h  8 BYTEs   (AL=00h only) filesystem type--string "FAT12" or "FAT16"
  62.  
  63. Return: CF set on error            AX = error code
  64.         CF clear if successful
  65. -------------------------------------------------------------------------
  66. NOTE -- DON'T TRY THESE PATCHES UNLESS YOU HAVE EXPERIENCE WITH DEBUG AND
  67.         KNOW EXACTLY WHAT YOU'RE DOING.
  68.  
  69. Patching FORMAT.COM (DOS 5.0) to create a serial number of 0000-0000 on
  70. your diskette requires changing bytes at
  71. DEBUG offset 4B91 from 03 C2 (ADD AX,DX) to 31 C0 (XOR AX,AX) and at
  72. DEBUG offset 4B9C from 03 C1 (ADD AX,CX) to 31 C0 (XOR AX,AX).
  73.  
  74. The same patch can be applied to DISKCOPY.COM (DOS 5.0) using DEBUG byte
  75. addresses at 0B2C and 0B36.
  76.  
  77. Byte 26h of the diskette boot record determines whether or not the volume
  78. serial number will be displayed by the DOS DIR command.  A value of 29h in
  79. this byte will display the volume serial number; any other value causes DIR to
  80. ignore the volume serial number (my diskettes contain the value 2Ah).
  81.  
  82. If you want to eliminate the serial number from ever being displayed by the
  83. DOS DIR command (regardless of byte 26h in the diskette boot record), and you
  84. really want to live dangerously, you can patch the DOS 5.0 COMMAND.COM file by
  85. replacing the byte at DEBUG offset 40A0 (currently 72h) to EBh.  This will
  86. change the instruction from JB 40AD to JMP 40AD.
  87.  
  88.                                                         Les Moskowitz
  89.                                                         11/23/91
  90.